﻿using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using HslCommunication.BasicFramework;
using HslCommunication.Core;
using HslCommunication.Core.Net;
using HslCommunication.LogNet;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace HslCommunication.MQTT
{
	/// <summary>
	/// 基于MQTT协议的同步访问的客户端程序，支持以同步的方式访问服务器的数据信息，并及时的反馈结果，当服务器启动文件功能时，也支持文件的上传，下载，删除操作等。<br />
	/// The client program based on MQTT protocol for synchronous access supports synchronous access to the server's data information and timely feedback of results,
	/// When the server starts the file function, it also supports file upload, download, and delete operations.
	/// </summary>
	/// <example>
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test" title="简单的实例化" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test2" title="带用户名密码的实例化" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test3" title="连接示例" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test4" title="读取数据示例" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test5" title="带进度报告示例" />
	/// 下面演示文件部分的功能的接口方法，主要包含，上传，下载，删除，遍历操作
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test6" title="下载文件功能" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test7" title="上传文件功能" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test8" title="删除文件功能" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test9" title="遍历指定目录的文件名功能" />
	/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\MQTT\MqttSyncClientSample.cs" region="Test10" title="遍历指定目录的所有子目录" />
	/// 上述的两个遍历的方法，就可以遍历出服务器的所有目录和文件了，具体可以参考 Demo 的MQTT文件客户端的演示界面。
	/// </example>
	// Token: 0x020000C9 RID: 201
	public class MqttSyncClient : NetworkDoubleBase
	{
		/// <summary>
		/// 实例化一个MQTT的同步客户端<br />
		/// Instantiate an MQTT synchronization client
		/// </summary>
		// Token: 0x06000EDE RID: 3806 RVA: 0x000578A4 File Offset: 0x00055AA4
		public MqttSyncClient(MqttConnectionOptions options)
		{
			base.ByteTransform = new RegularByteTransform();
			this.connectionOptions = options;
			this.IpAddress = options.IpAddress;
			this.Port = options.Port;
			this.incrementCount = new SoftIncrementCount(65535L, 1L, 1);
			this.ConnectTimeOut = options.ConnectTimeout;
			this.receiveTimeOut = 60000;
		}

		/// <summary>
		/// 通过指定的ip地址及端口来实例化一个同步的MQTT客户端<br />
		/// Instantiate a synchronized MQTT client with the specified IP address and port
		/// </summary>
		/// <param name="ipAddress">IP地址信息</param>
		/// <param name="port">端口号信息</param>
		// Token: 0x06000EDF RID: 3807 RVA: 0x00057920 File Offset: 0x00055B20
		public MqttSyncClient(string ipAddress, int port)
		{
			this.connectionOptions = new MqttConnectionOptions
			{
				IpAddress = ipAddress,
				Port = port
			};
			base.ByteTransform = new RegularByteTransform();
			this.IpAddress = ipAddress;
			this.Port = port;
			this.incrementCount = new SoftIncrementCount(65535L, 1L, 1);
			this.receiveTimeOut = 60000;
		}

		/// <summary>
		/// 通过指定的ip地址及端口来实例化一个同步的MQTT客户端<br />
		/// Instantiate a synchronized MQTT client with the specified IP address and port
		/// </summary>
		/// <param name="ipAddress">IP地址信息</param>
		/// <param name="port">端口号信息</param>
		// Token: 0x06000EE0 RID: 3808 RVA: 0x00057998 File Offset: 0x00055B98
		public MqttSyncClient(IPAddress ipAddress, int port)
		{
			this.connectionOptions = new MqttConnectionOptions
			{
				IpAddress = ipAddress.ToString(),
				Port = port
			};
			base.ByteTransform = new RegularByteTransform();
			this.IpAddress = ipAddress.ToString();
			this.Port = port;
			this.incrementCount = new SoftIncrementCount(65535L, 1L, 1);
		}

		/// <inheritdoc />
		// Token: 0x06000EE1 RID: 3809 RVA: 0x00057A10 File Offset: 0x00055C10
		protected override OperateResult InitializationOnConnect(Socket socket)
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildConnectMqttCommand(this.connectionOptions, "HUSL");
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = base.Send(socket, operateResult.Content);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					OperateResult<byte, byte[]> operateResult3 = base.ReceiveMqttMessage(socket, base.ReceiveTimeOut, null);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = operateResult3;
					}
					else
					{
						OperateResult operateResult4 = MqttHelper.CheckConnectBack(operateResult3.Content1, operateResult3.Content2);
						bool flag4 = !operateResult4.IsSuccess;
						if (flag4)
						{
							if (socket != null)
							{
								socket.Close();
							}
							result = operateResult4;
						}
						else
						{
							this.incrementCount.ResetCurrentValue();
							result = OperateResult.CreateSuccessResult();
						}
					}
				}
			}
			return result;
		}

		/// <inheritdoc />
		// Token: 0x06000EE2 RID: 3810 RVA: 0x00057AD8 File Offset: 0x00055CD8
		[DebuggerStepThrough]
		protected override Task<OperateResult> InitializationOnConnectAsync(Socket socket)
		{
			MqttSyncClient.<InitializationOnConnectAsync>d__4 <InitializationOnConnectAsync>d__ = new MqttSyncClient.<InitializationOnConnectAsync>d__4();
			<InitializationOnConnectAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<InitializationOnConnectAsync>d__.<>4__this = this;
			<InitializationOnConnectAsync>d__.socket = socket;
			<InitializationOnConnectAsync>d__.<>1__state = -1;
			<InitializationOnConnectAsync>d__.<>t__builder.Start<MqttSyncClient.<InitializationOnConnectAsync>d__4>(ref <InitializationOnConnectAsync>d__);
			return <InitializationOnConnectAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc />
		// Token: 0x06000EE3 RID: 3811 RVA: 0x00057B24 File Offset: 0x00055D24
		public override OperateResult<byte[]> ReadFromCoreServer(Socket socket, byte[] send, bool hasResponseData = true, bool usePackHeader = true)
		{
			OperateResult<byte, byte[]> operateResult = this.ReadMqttFromCoreServer(socket, send, null, null, null);
			bool isSuccess = operateResult.IsSuccess;
			OperateResult<byte[]> result;
			if (isSuccess)
			{
				result = OperateResult.CreateSuccessResult<byte[]>(operateResult.Content2);
			}
			else
			{
				result = OperateResult.CreateFailedResult<byte[]>(operateResult);
			}
			return result;
		}

		// Token: 0x06000EE4 RID: 3812 RVA: 0x00057B60 File Offset: 0x00055D60
		private OperateResult<byte, byte[]> ReadMqttFromCoreServer(Socket socket, byte[] send, Action<long, long> sendProgress, Action<string, string> handleProgress, Action<long, long> receiveProgress)
		{
			OperateResult operateResult = base.Send(socket, send);
			bool flag = !operateResult.IsSuccess;
			OperateResult<byte, byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<byte, byte[]>(operateResult);
			}
			else
			{
				OperateResult<byte, byte[]> operateResult2;
				OperateResult<string, byte[]> operateResult3;
				for (;;)
				{
					operateResult2 = base.ReceiveMqttMessage(socket, base.ReceiveTimeOut, null);
					bool flag2 = !operateResult2.IsSuccess;
					if (flag2)
					{
						break;
					}
					operateResult3 = MqttHelper.ExtraMqttReceiveData(operateResult2.Content1, operateResult2.Content2);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						goto Block_3;
					}
					bool flag4 = operateResult3.Content2.Length != 16;
					if (flag4)
					{
						goto Block_4;
					}
					long num = BitConverter.ToInt64(operateResult3.Content2, 0);
					long num2 = BitConverter.ToInt64(operateResult3.Content2, 8);
					if (sendProgress != null)
					{
						sendProgress(num, num2);
					}
					bool flag5 = num == num2;
					if (flag5)
					{
						goto Block_6;
					}
				}
				return operateResult2;
				Block_3:
				return OperateResult.CreateFailedResult<byte, byte[]>(operateResult3);
				Block_4:
				return new OperateResult<byte, byte[]>(StringResources.Language.ReceiveDataLengthTooShort);
				Block_6:
				OperateResult<byte, byte[]> operateResult4;
				for (;;)
				{
					operateResult4 = base.ReceiveMqttMessage(socket, base.ReceiveTimeOut, receiveProgress);
					bool flag6 = !operateResult4.IsSuccess;
					if (flag6)
					{
						break;
					}
					bool flag7 = operateResult4.Content1 >> 4 == 15;
					if (!flag7)
					{
						goto IL_16C;
					}
					OperateResult<string, byte[]> operateResult5 = MqttHelper.ExtraMqttReceiveData(operateResult4.Content1, operateResult4.Content2);
					if (handleProgress != null)
					{
						handleProgress(operateResult5.Content1, Encoding.UTF8.GetString(operateResult5.Content2));
					}
				}
				return operateResult4;
				IL_16C:
				result = OperateResult.CreateSuccessResult<byte, byte[]>(operateResult4.Content1, operateResult4.Content2);
			}
			return result;
		}

		// Token: 0x06000EE5 RID: 3813 RVA: 0x00057CFC File Offset: 0x00055EFC
		private OperateResult<byte[]> ReadMqttFromCoreServer(byte[] send, Action<long, long> sendProgress, Action<string, string> handleProgress, Action<long, long> receiveProgress)
		{
			OperateResult<byte[]> operateResult = new OperateResult<byte[]>();
			OperateResult<Socket> operateResult2 = null;
			this.InteractiveLock.Enter();
			try
			{
				operateResult2 = base.GetAvailableSocket();
				bool flag = !operateResult2.IsSuccess;
				if (flag)
				{
					this.IsSocketError = true;
					AlienSession alienSession = base.AlienSession;
					if (alienSession != null)
					{
						alienSession.Offline();
					}
					this.InteractiveLock.Leave();
					operateResult.CopyErrorFromOther<OperateResult<Socket>>(operateResult2);
					return operateResult;
				}
				OperateResult<byte, byte[]> operateResult3 = this.ReadMqttFromCoreServer(operateResult2.Content, send, sendProgress, handleProgress, receiveProgress);
				bool isSuccess = operateResult3.IsSuccess;
				if (isSuccess)
				{
					this.IsSocketError = false;
					bool flag2 = operateResult3.Content1 >> 4 == 0;
					if (flag2)
					{
						OperateResult<string, byte[]> operateResult4 = MqttHelper.ExtraMqttReceiveData(operateResult3.Content1, operateResult3.Content2);
						operateResult.IsSuccess = false;
						operateResult.ErrorCode = int.Parse(operateResult4.Content1);
						operateResult.Message = Encoding.UTF8.GetString(operateResult4.Content2);
					}
					else
					{
						operateResult.IsSuccess = operateResult3.IsSuccess;
						operateResult.Content = operateResult3.Content2;
						operateResult.Message = StringResources.Language.SuccessText;
					}
				}
				else
				{
					this.IsSocketError = true;
					AlienSession alienSession2 = base.AlienSession;
					if (alienSession2 != null)
					{
						alienSession2.Offline();
					}
					operateResult.CopyErrorFromOther<OperateResult<byte, byte[]>>(operateResult3);
				}
				this.ExtraAfterReadFromCoreServer(operateResult3);
				this.InteractiveLock.Leave();
			}
			catch
			{
				this.InteractiveLock.Leave();
				throw;
			}
			bool flag3 = !this.isPersistentConn;
			if (flag3)
			{
				if (operateResult2 != null)
				{
					Socket content = operateResult2.Content;
					if (content != null)
					{
						content.Close();
					}
				}
			}
			return operateResult;
		}

		/// <inheritdoc />
		// Token: 0x06000EE6 RID: 3814 RVA: 0x00057EB0 File Offset: 0x000560B0
		[DebuggerStepThrough]
		public override Task<OperateResult<byte[]>> ReadFromCoreServerAsync(Socket socket, byte[] send, bool hasResponseData = true, bool usePackHeader = true)
		{
			MqttSyncClient.<ReadFromCoreServerAsync>d__8 <ReadFromCoreServerAsync>d__ = new MqttSyncClient.<ReadFromCoreServerAsync>d__8();
			<ReadFromCoreServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadFromCoreServerAsync>d__.<>4__this = this;
			<ReadFromCoreServerAsync>d__.socket = socket;
			<ReadFromCoreServerAsync>d__.send = send;
			<ReadFromCoreServerAsync>d__.hasResponseData = hasResponseData;
			<ReadFromCoreServerAsync>d__.usePackHeader = usePackHeader;
			<ReadFromCoreServerAsync>d__.<>1__state = -1;
			<ReadFromCoreServerAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadFromCoreServerAsync>d__8>(ref <ReadFromCoreServerAsync>d__);
			return <ReadFromCoreServerAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000EE7 RID: 3815 RVA: 0x00057F14 File Offset: 0x00056114
		[DebuggerStepThrough]
		private Task<OperateResult<byte, byte[]>> ReadMqttFromCoreServerAsync(Socket socket, byte[] send, Action<long, long> sendProgress, Action<string, string> handleProgress, Action<long, long> receiveProgress)
		{
			MqttSyncClient.<ReadMqttFromCoreServerAsync>d__9 <ReadMqttFromCoreServerAsync>d__ = new MqttSyncClient.<ReadMqttFromCoreServerAsync>d__9();
			<ReadMqttFromCoreServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte, byte[]>>.Create();
			<ReadMqttFromCoreServerAsync>d__.<>4__this = this;
			<ReadMqttFromCoreServerAsync>d__.socket = socket;
			<ReadMqttFromCoreServerAsync>d__.send = send;
			<ReadMqttFromCoreServerAsync>d__.sendProgress = sendProgress;
			<ReadMqttFromCoreServerAsync>d__.handleProgress = handleProgress;
			<ReadMqttFromCoreServerAsync>d__.receiveProgress = receiveProgress;
			<ReadMqttFromCoreServerAsync>d__.<>1__state = -1;
			<ReadMqttFromCoreServerAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadMqttFromCoreServerAsync>d__9>(ref <ReadMqttFromCoreServerAsync>d__);
			return <ReadMqttFromCoreServerAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000EE8 RID: 3816 RVA: 0x00057F80 File Offset: 0x00056180
		[DebuggerStepThrough]
		private Task<OperateResult<byte[]>> ReadMqttFromCoreServerAsync(byte[] send, Action<long, long> sendProgress, Action<string, string> handleProgress, Action<long, long> receiveProgress)
		{
			MqttSyncClient.<ReadMqttFromCoreServerAsync>d__10 <ReadMqttFromCoreServerAsync>d__ = new MqttSyncClient.<ReadMqttFromCoreServerAsync>d__10();
			<ReadMqttFromCoreServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<byte[]>>.Create();
			<ReadMqttFromCoreServerAsync>d__.<>4__this = this;
			<ReadMqttFromCoreServerAsync>d__.send = send;
			<ReadMqttFromCoreServerAsync>d__.sendProgress = sendProgress;
			<ReadMqttFromCoreServerAsync>d__.handleProgress = handleProgress;
			<ReadMqttFromCoreServerAsync>d__.receiveProgress = receiveProgress;
			<ReadMqttFromCoreServerAsync>d__.<>1__state = -1;
			<ReadMqttFromCoreServerAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadMqttFromCoreServerAsync>d__10>(ref <ReadMqttFromCoreServerAsync>d__);
			return <ReadMqttFromCoreServerAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 从MQTT服务器同步读取数据，将payload发送到服务器，然后从服务器返回相关的数据，支持数据发送进度报告，服务器执行进度报告，接收数据进度报告操作<br />
		/// Synchronously read data from the MQTT server, send the payload to the server, and then return relevant data from the server, 
		/// support data transmission progress report, the server executes the progress report, and receives the data progress report
		/// </summary>
		/// <remarks>
		/// 进度报告可以实现一个比较有意思的功能，可以用来数据的上传和下载，提供一个友好的进度条，因为网络的好坏通常是不确定的。
		/// </remarks>
		/// <param name="topic">主题信息</param>
		/// <param name="payload">负载数据</param>
		/// <param name="sendProgress">发送数据给服务器时的进度报告，第一个参数为已发送数据，第二个参数为总发送数据</param>
		/// <param name="handleProgress">服务器处理数据的进度报告，第一个参数Topic自定义，通常用来传送操作百分比，第二个参数自定义，通常用来表示服务器消息</param>
		/// <param name="receiveProgress">从服务器接收数据的进度报告，第一个参数为已接收数据，第二个参数为总接收数据</param>
		/// <returns>服务器返回的数据信息</returns>
		// Token: 0x06000EE9 RID: 3817 RVA: 0x00057FE4 File Offset: 0x000561E4
		public OperateResult<string, byte[]> Read(string topic, byte[] payload, Action<long, long> sendProgress = null, Action<string, string> handleProgress = null, Action<long, long> receiveProgress = null)
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildPublishMqttCommand(topic, payload);
			bool flag = !operateResult.IsSuccess;
			OperateResult<string, byte[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<string, byte[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadMqttFromCoreServer(operateResult.Content, sendProgress, handleProgress, receiveProgress);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<string, byte[]>(operateResult2);
				}
				else
				{
					result = MqttHelper.ExtraMqttReceiveData(3, operateResult2.Content);
				}
			}
			return result;
		}

		/// <summary>
		/// 从MQTT服务器同步读取数据，将指定编码的字符串payload发送到服务器，然后从服务器返回相关的数据，并转换为指定编码的字符串，支持数据发送进度报告，服务器执行进度报告，接收数据进度报告操作<br />
		/// Synchronously read data from the MQTT server, send the specified encoded string payload to the server, 
		/// and then return the data from the server, and convert it to the specified encoded string,
		/// support data transmission progress report, the server executes the progress report, and receives the data progress report
		/// </summary>
		/// <param name="topic">主题信息</param>
		/// <param name="payload">负载数据</param>
		/// <param name="sendProgress">发送数据给服务器时的进度报告，第一个参数为已发送数据，第二个参数为总发送数据</param>
		/// <param name="handleProgress">服务器处理数据的进度报告，第一个参数Topic自定义，通常用来传送操作百分比，第二个参数自定义，通常用来表示服务器消息</param>
		/// <param name="receiveProgress">从服务器接收数据的进度报告，第一个参数为已接收数据，第二个参数为总接收数据</param>
		/// <returns>服务器返回的数据信息</returns>
		// Token: 0x06000EEA RID: 3818 RVA: 0x0005804C File Offset: 0x0005624C
		public OperateResult<string, string> ReadString(string topic, string payload, Action<long, long> sendProgress = null, Action<string, string> handleProgress = null, Action<long, long> receiveProgress = null)
		{
			OperateResult<string, byte[]> operateResult = this.Read(topic, string.IsNullOrEmpty(payload) ? null : this.stringEncoding.GetBytes(payload), sendProgress, handleProgress, receiveProgress);
			bool flag = !operateResult.IsSuccess;
			OperateResult<string, string> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<string, string>(operateResult);
			}
			else
			{
				result = OperateResult.CreateSuccessResult<string, string>(operateResult.Content1, this.stringEncoding.GetString(operateResult.Content2));
			}
			return result;
		}

		/// <summary>
		/// 读取MQTT服务器注册的RPC接口，忽略返回的Topic数据，直接将结果转换为泛型对象，如果JSON转换失败，将返回错误，参数传递主题和数据负载，
		/// 数据负载示例："{\"address\": \"100\",\"length\": 10}" 本质是一个字符串。<br />
		/// Read the RPC interface registered by the MQTT server, ignore the returned Topic data, and directly convert the result into a generic object. 
		/// If the JSON conversion fails, an error will be returned. The parameter passes the topic and the data payload. 
		/// The data payload example: "{\"address\ ": \"100\",\"length\": 10}" is essentially a string.
		/// </summary>
		/// <typeparam name="T">泛型对象，需要和返回的数据匹配，如果返回的是 int 数组，那么这里就是 int[]</typeparam>
		/// <param name="topic">主题信息，也是服务器的 RPC 接口信息</param>
		/// <param name="payload">传递的参数信息，示例："{\"address\": \"100\",\"length\": 10}" 本质是一个字符串。</param>
		/// <returns>服务器返回的数据信息</returns>
		// Token: 0x06000EEB RID: 3819 RVA: 0x000580B4 File Offset: 0x000562B4
		public OperateResult<T> ReadRpc<T>(string topic, string payload)
		{
			OperateResult<string, string> operateResult = this.ReadString(topic, payload, null, null, null);
			bool flag = !operateResult.IsSuccess;
			OperateResult<T> result;
			if (flag)
			{
				result = operateResult.ConvertFailed<T>();
			}
			else
			{
				try
				{
					result = OperateResult.CreateSuccessResult<T>(JsonConvert.DeserializeObject<T>(operateResult.Content2));
				}
				catch (Exception ex)
				{
					result = new OperateResult<T>("JSON failed: " + ex.Message);
				}
			}
			return result;
		}

		/// <summary>
		/// 读取MQTT服务器注册的RPC接口，忽略返回的Topic数据，直接将结果转换为泛型对象，如果JSON转换失败，将返回错误，参数传递主题和数据负载，
		/// 数据负载示例：new { address = "", length = 0 } 本质是一个匿名对象。<br />
		/// Read the RPC interface registered by the MQTT server, ignore the returned Topic data, and directly convert the result into a generic object. 
		/// If the JSON conversion fails, an error will be returned. The parameter passes the topic and the data payload. 
		/// The data payload example: new { address = "", length = 0 } is essentially an anonymous object.
		/// </summary>
		/// <typeparam name="T">泛型对象，需要和返回的数据匹配，如果返回的是 int 数组，那么这里就是 int[]</typeparam>
		/// <param name="topic">主题信息，也是服务器的 RPC 接口信息</param>
		/// <param name="payload">传递的参数信息，示例：new { address = "", length = 0 } 本质是一个匿名对象。</param>
		/// <returns>服务器返回的数据信息</returns>
		// Token: 0x06000EEC RID: 3820 RVA: 0x00058124 File Offset: 0x00056324
		public OperateResult<T> ReadRpc<T>(string topic, object payload)
		{
			return this.ReadRpc<T>(topic, (payload == null) ? "{}" : payload.ToJsonString(1));
		}

		/// <summary>
		/// 读取服务器的已经注册的API信息列表，将返回API的主题路径，注释信息，示例的传入的数据信息。<br />
		/// Read the registered API information list of the server, and return the API subject path, annotation information, and sample incoming data information.
		/// </summary>
		/// <returns>包含是否成功的api信息的列表</returns>
		// Token: 0x06000EED RID: 3821 RVA: 0x00058140 File Offset: 0x00056340
		public OperateResult<MqttRpcApiInfo[]> ReadRpcApis()
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildMqttCommand(8, 0, MqttHelper.BuildSegCommandByString(""), null);
			bool flag = !operateResult.IsSuccess;
			OperateResult<MqttRpcApiInfo[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<MqttRpcApiInfo[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadMqttFromCoreServer(operateResult.Content, null, null, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<MqttRpcApiInfo[]>(operateResult2);
				}
				else
				{
					OperateResult<string, byte[]> operateResult3 = MqttHelper.ExtraMqttReceiveData(3, operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<MqttRpcApiInfo[]>(operateResult3);
					}
					else
					{
						result = OperateResult.CreateSuccessResult<MqttRpcApiInfo[]>(JArray.Parse(Encoding.UTF8.GetString(operateResult3.Content2)).ToObject<MqttRpcApiInfo[]>());
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 读取服务器的指定的API接口的每天的调用次数，如果API接口不存在，或是还没有调用数据，则返回失败。<br />
		/// Read the number of calls per day of the designated API interface of the server. 
		/// If the API interface does not exist or the data has not been called yet, it returns a failure.
		/// </summary>
		/// <remarks>
		/// 如果api的参数为空字符串，就是请求所有的接口的调用的统计信息。
		/// </remarks>
		/// <param name="api">等待请求的API的接口信息，如果为空，就是请求所有的接口的调用的统计信息。</param>
		/// <returns>最近几日的连续的调用情况，例如[1,2,3]，表示前提调用1次，昨天调用2次，今天3次</returns>
		// Token: 0x06000EEE RID: 3822 RVA: 0x000581EC File Offset: 0x000563EC
		public OperateResult<long[]> ReadRpcApiLog(string api)
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildMqttCommand(6, 0, MqttHelper.BuildSegCommandByString(api), null);
			bool flag = !operateResult.IsSuccess;
			OperateResult<long[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<long[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadMqttFromCoreServer(operateResult.Content, null, null, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<long[]>(operateResult2);
				}
				else
				{
					OperateResult<string, byte[]> operateResult3 = MqttHelper.ExtraMqttReceiveData(3, operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<long[]>(operateResult3);
					}
					else
					{
						string @string = Encoding.UTF8.GetString(operateResult3.Content2);
						result = OperateResult.CreateSuccessResult<long[]>(@string.ToStringArray<long>());
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 读取服务器的已经驻留的所有消息的主题列表<br />
		/// Read the topic list of all messages that have resided on the server
		/// </summary>
		/// <returns>消息列表对象</returns>
		// Token: 0x06000EEF RID: 3823 RVA: 0x00058294 File Offset: 0x00056494
		public OperateResult<string[]> ReadRetainTopics()
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildMqttCommand(4, 0, MqttHelper.BuildSegCommandByString(""), null);
			bool flag = !operateResult.IsSuccess;
			OperateResult<string[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<string[]>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadMqttFromCoreServer(operateResult.Content, null, null, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<string[]>(operateResult2);
				}
				else
				{
					OperateResult<string, byte[]> operateResult3 = MqttHelper.ExtraMqttReceiveData(3, operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<string[]>(operateResult3);
					}
					else
					{
						result = OperateResult.CreateSuccessResult<string[]>(HslProtocol.UnPackStringArrayFromByte(operateResult3.Content2));
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 读取服务器的已经驻留的指定主题的消息内容<br />
		/// Read the topic list of all messages that have resided on the server
		/// </summary>
		/// <param name="topic">指定的主题消息</param>
		/// <param name="receiveProgress">结果进度报告</param>
		/// <returns>消息列表对象</returns>
		// Token: 0x06000EF0 RID: 3824 RVA: 0x00058334 File Offset: 0x00056534
		public OperateResult<MqttClientApplicationMessage> ReadTopicPayload(string topic, Action<long, long> receiveProgress = null)
		{
			OperateResult<byte[]> operateResult = MqttHelper.BuildMqttCommand(5, 0, MqttHelper.BuildSegCommandByString(topic), null);
			bool flag = !operateResult.IsSuccess;
			OperateResult<MqttClientApplicationMessage> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<MqttClientApplicationMessage>(operateResult);
			}
			else
			{
				OperateResult<byte[]> operateResult2 = this.ReadMqttFromCoreServer(operateResult.Content, null, null, receiveProgress);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<MqttClientApplicationMessage>(operateResult2);
				}
				else
				{
					OperateResult<string, byte[]> operateResult3 = MqttHelper.ExtraMqttReceiveData(3, operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<MqttClientApplicationMessage>(operateResult3);
					}
					else
					{
						result = OperateResult.CreateSuccessResult<MqttClientApplicationMessage>(JObject.Parse(Encoding.UTF8.GetString(operateResult3.Content2)).ToObject<MqttClientApplicationMessage>());
					}
				}
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.Read(System.String,System.Byte[],System.Action{System.Int64,System.Int64},System.Action{System.String,System.String},System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000EF1 RID: 3825 RVA: 0x000583DC File Offset: 0x000565DC
		[DebuggerStepThrough]
		public Task<OperateResult<string, byte[]>> ReadAsync(string topic, byte[] payload, Action<long, long> sendProgress = null, Action<string, string> handleProgress = null, Action<long, long> receiveProgress = null)
		{
			MqttSyncClient.<ReadAsync>d__19 <ReadAsync>d__ = new MqttSyncClient.<ReadAsync>d__19();
			<ReadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string, byte[]>>.Create();
			<ReadAsync>d__.<>4__this = this;
			<ReadAsync>d__.topic = topic;
			<ReadAsync>d__.payload = payload;
			<ReadAsync>d__.sendProgress = sendProgress;
			<ReadAsync>d__.handleProgress = handleProgress;
			<ReadAsync>d__.receiveProgress = receiveProgress;
			<ReadAsync>d__.<>1__state = -1;
			<ReadAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadAsync>d__19>(ref <ReadAsync>d__);
			return <ReadAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadString(System.String,System.String,System.Action{System.Int64,System.Int64},System.Action{System.String,System.String},System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000EF2 RID: 3826 RVA: 0x00058448 File Offset: 0x00056648
		[DebuggerStepThrough]
		public Task<OperateResult<string, string>> ReadStringAsync(string topic, string payload, Action<long, long> sendProgress = null, Action<string, string> handleProgress = null, Action<long, long> receiveProgress = null)
		{
			MqttSyncClient.<ReadStringAsync>d__20 <ReadStringAsync>d__ = new MqttSyncClient.<ReadStringAsync>d__20();
			<ReadStringAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string, string>>.Create();
			<ReadStringAsync>d__.<>4__this = this;
			<ReadStringAsync>d__.topic = topic;
			<ReadStringAsync>d__.payload = payload;
			<ReadStringAsync>d__.sendProgress = sendProgress;
			<ReadStringAsync>d__.handleProgress = handleProgress;
			<ReadStringAsync>d__.receiveProgress = receiveProgress;
			<ReadStringAsync>d__.<>1__state = -1;
			<ReadStringAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadStringAsync>d__20>(ref <ReadStringAsync>d__);
			return <ReadStringAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadRpc``1(System.String,System.String)" />
		// Token: 0x06000EF3 RID: 3827 RVA: 0x000584B4 File Offset: 0x000566B4
		[DebuggerStepThrough]
		public Task<OperateResult<T>> ReadRpcAsync<T>(string topic, string payload)
		{
			MqttSyncClient.<ReadRpcAsync>d__21<T> <ReadRpcAsync>d__ = new MqttSyncClient.<ReadRpcAsync>d__21<T>();
			<ReadRpcAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<T>>.Create();
			<ReadRpcAsync>d__.<>4__this = this;
			<ReadRpcAsync>d__.topic = topic;
			<ReadRpcAsync>d__.payload = payload;
			<ReadRpcAsync>d__.<>1__state = -1;
			<ReadRpcAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadRpcAsync>d__21<T>>(ref <ReadRpcAsync>d__);
			return <ReadRpcAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadRpc``1(System.String,System.Object)" />
		// Token: 0x06000EF4 RID: 3828 RVA: 0x00058508 File Offset: 0x00056708
		[DebuggerStepThrough]
		public Task<OperateResult<T>> ReadRpcAsync<T>(string topic, object payload)
		{
			MqttSyncClient.<ReadRpcAsync>d__22<T> <ReadRpcAsync>d__ = new MqttSyncClient.<ReadRpcAsync>d__22<T>();
			<ReadRpcAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<T>>.Create();
			<ReadRpcAsync>d__.<>4__this = this;
			<ReadRpcAsync>d__.topic = topic;
			<ReadRpcAsync>d__.payload = payload;
			<ReadRpcAsync>d__.<>1__state = -1;
			<ReadRpcAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadRpcAsync>d__22<T>>(ref <ReadRpcAsync>d__);
			return <ReadRpcAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadRpcApis" />
		// Token: 0x06000EF5 RID: 3829 RVA: 0x0005855C File Offset: 0x0005675C
		[DebuggerStepThrough]
		public Task<OperateResult<MqttRpcApiInfo[]>> ReadRpcApisAsync()
		{
			MqttSyncClient.<ReadRpcApisAsync>d__23 <ReadRpcApisAsync>d__ = new MqttSyncClient.<ReadRpcApisAsync>d__23();
			<ReadRpcApisAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<MqttRpcApiInfo[]>>.Create();
			<ReadRpcApisAsync>d__.<>4__this = this;
			<ReadRpcApisAsync>d__.<>1__state = -1;
			<ReadRpcApisAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadRpcApisAsync>d__23>(ref <ReadRpcApisAsync>d__);
			return <ReadRpcApisAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadRpcApiLog(System.String)" />
		// Token: 0x06000EF6 RID: 3830 RVA: 0x000585A0 File Offset: 0x000567A0
		[DebuggerStepThrough]
		public Task<OperateResult<long[]>> ReadRpcApiLogAsync(string api)
		{
			MqttSyncClient.<ReadRpcApiLogAsync>d__24 <ReadRpcApiLogAsync>d__ = new MqttSyncClient.<ReadRpcApiLogAsync>d__24();
			<ReadRpcApiLogAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<long[]>>.Create();
			<ReadRpcApiLogAsync>d__.<>4__this = this;
			<ReadRpcApiLogAsync>d__.api = api;
			<ReadRpcApiLogAsync>d__.<>1__state = -1;
			<ReadRpcApiLogAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadRpcApiLogAsync>d__24>(ref <ReadRpcApiLogAsync>d__);
			return <ReadRpcApiLogAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadRetainTopics" />
		// Token: 0x06000EF7 RID: 3831 RVA: 0x000585EC File Offset: 0x000567EC
		[DebuggerStepThrough]
		public Task<OperateResult<string[]>> ReadRetainTopicsAsync()
		{
			MqttSyncClient.<ReadRetainTopicsAsync>d__25 <ReadRetainTopicsAsync>d__ = new MqttSyncClient.<ReadRetainTopicsAsync>d__25();
			<ReadRetainTopicsAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string[]>>.Create();
			<ReadRetainTopicsAsync>d__.<>4__this = this;
			<ReadRetainTopicsAsync>d__.<>1__state = -1;
			<ReadRetainTopicsAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadRetainTopicsAsync>d__25>(ref <ReadRetainTopicsAsync>d__);
			return <ReadRetainTopicsAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.ReadTopicPayload(System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000EF8 RID: 3832 RVA: 0x00058630 File Offset: 0x00056830
		[DebuggerStepThrough]
		public Task<OperateResult<MqttClientApplicationMessage>> ReadTopicPayloadAsync(string topic, Action<long, long> receiveProgress = null)
		{
			MqttSyncClient.<ReadTopicPayloadAsync>d__26 <ReadTopicPayloadAsync>d__ = new MqttSyncClient.<ReadTopicPayloadAsync>d__26();
			<ReadTopicPayloadAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<MqttClientApplicationMessage>>.Create();
			<ReadTopicPayloadAsync>d__.<>4__this = this;
			<ReadTopicPayloadAsync>d__.topic = topic;
			<ReadTopicPayloadAsync>d__.receiveProgress = receiveProgress;
			<ReadTopicPayloadAsync>d__.<>1__state = -1;
			<ReadTopicPayloadAsync>d__.<>t__builder.Start<MqttSyncClient.<ReadTopicPayloadAsync>d__26>(ref <ReadTopicPayloadAsync>d__);
			return <ReadTopicPayloadAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000EF9 RID: 3833 RVA: 0x00058684 File Offset: 0x00056884
		private OperateResult<Socket> ConnectFileServer(byte code, string groups, string[] fileNames)
		{
			OperateResult<Socket> operateResult = base.CreateSocketAndConnect(this.IpAddress, this.Port, this.ConnectTimeOut);
			bool flag = !operateResult.IsSuccess;
			OperateResult<Socket> result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult<byte[]> operateResult2 = MqttHelper.BuildConnectMqttCommand(this.connectionOptions, "FILE");
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					result = OperateResult.CreateFailedResult<Socket>(operateResult2);
				}
				else
				{
					OperateResult operateResult3 = base.Send(operateResult.Content, operateResult2.Content);
					bool flag3 = !operateResult3.IsSuccess;
					if (flag3)
					{
						result = OperateResult.CreateFailedResult<Socket>(operateResult3);
					}
					else
					{
						OperateResult<byte, byte[]> operateResult4 = base.ReceiveMqttMessage(operateResult.Content, base.ReceiveTimeOut, null);
						bool flag4 = !operateResult4.IsSuccess;
						if (flag4)
						{
							Socket content2 = operateResult.Content;
							if (content2 != null)
							{
								content2.Close();
							}
							result = OperateResult.CreateFailedResult<Socket>(operateResult4);
						}
						else
						{
							OperateResult operateResult5 = MqttHelper.CheckConnectBack(operateResult4.Content1, operateResult4.Content2);
							bool flag5 = !operateResult5.IsSuccess;
							if (flag5)
							{
								Socket content3 = operateResult.Content;
								if (content3 != null)
								{
									content3.Close();
								}
								result = OperateResult.CreateFailedResult<Socket>(operateResult5);
							}
							else
							{
								OperateResult operateResult6 = base.Send(operateResult.Content, MqttHelper.BuildMqttCommand(code, null, HslProtocol.PackStringArrayToByte(string.IsNullOrEmpty(groups) ? null : groups.Split(new char[]
								{
									'\\',
									'/'
								}, StringSplitOptions.RemoveEmptyEntries))).Content);
								bool flag6 = !operateResult6.IsSuccess;
								if (flag6)
								{
									result = OperateResult.CreateFailedResult<Socket>(operateResult6);
								}
								else
								{
									OperateResult operateResult7 = base.Send(operateResult.Content, MqttHelper.BuildMqttCommand(code, null, HslProtocol.PackStringArrayToByte(fileNames)).Content);
									bool flag7 = !operateResult7.IsSuccess;
									if (flag7)
									{
										result = OperateResult.CreateFailedResult<Socket>(operateResult7);
									}
									else
									{
										OperateResult<byte, byte[]> operateResult8 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
										bool flag8 = !operateResult8.IsSuccess;
										if (flag8)
										{
											result = OperateResult.CreateFailedResult<Socket>(operateResult8);
										}
										else
										{
											bool flag9 = operateResult8.Content1 == 0;
											if (flag9)
											{
												Socket content4 = operateResult.Content;
												if (content4 != null)
												{
													content4.Close();
												}
												result = new OperateResult<Socket>(Encoding.UTF8.GetString(operateResult8.Content2));
											}
											else
											{
												result = OperateResult.CreateSuccessResult<Socket>(operateResult.Content);
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return result;
		}

		// Token: 0x06000EFA RID: 3834 RVA: 0x000588D0 File Offset: 0x00056AD0
		private OperateResult DownloadFileBase(string groups, string fileName, Action<long, long> processReport, object source)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(101, groups, new string[]
			{
				fileName
			});
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				OperateResult operateResult2 = base.ReceiveMqttFile(operateResult.Content, source, processReport);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = operateResult2;
				}
				else
				{
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					result = OperateResult.CreateSuccessResult();
				}
			}
			return result;
		}

		/// <summary>
		/// 从远程服务器下载一个文件到本地，需要指定文件类别，文件名，进度报告，本地保存的文件名<br />
		/// To download a file from a remote server to the local, you need to specify the file category, file name, progress report, and file name saved locally
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分 </param>
		/// <param name="fileName">文件名称，例如 123.txt</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <param name="fileSaveName">本地保存的文件名</param>
		/// <returns>是否下载成功</returns>
		// Token: 0x06000EFB RID: 3835 RVA: 0x00058944 File Offset: 0x00056B44
		public OperateResult DownloadFile(string groups, string fileName, Action<long, long> processReport, string fileSaveName)
		{
			return this.DownloadFileBase(groups, fileName, processReport, fileSaveName);
		}

		/// <summary>
		/// 从远程服务器下载一个文件到流中，需要指定文件类别，文件名，进度报告，本地保存的文件名<br />
		/// To download a file from a remote server to the stream, you need to specify the file category, file name, progress report, and file name saved locally
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分 </param>
		/// <param name="fileName">文件名称，例如 123.txt</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <param name="stream">数据流</param>
		/// <returns>是否下载成功</returns>
		// Token: 0x06000EFC RID: 3836 RVA: 0x00058964 File Offset: 0x00056B64
		public OperateResult DownloadFile(string groups, string fileName, Action<long, long> processReport, Stream stream)
		{
			return this.DownloadFileBase(groups, fileName, processReport, stream);
		}

		/// <summary>
		/// 从远程服务器下载一个文件，生成一个Bitmap图片对象，需要指定文件类别，文件名，进度报告，可用于用户头像的存储<br />
		/// Download a file from a remote server and generate a Bitmap image object. You need to specify the file category, file name, and progress report, which can be used to store the user's avatar
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="fileName">文件名称，例如 123.txt</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <returns>如果下载成功，则携带图片资源对象</returns>
		// Token: 0x06000EFD RID: 3837 RVA: 0x00058984 File Offset: 0x00056B84
		public OperateResult<Bitmap> DownloadBitmap(string groups, string fileName, Action<long, long> processReport)
		{
			MemoryStream memoryStream = new MemoryStream();
			OperateResult operateResult = this.DownloadFileBase(groups, fileName, processReport, memoryStream);
			bool flag = !operateResult.IsSuccess;
			OperateResult<Bitmap> result;
			if (flag)
			{
				memoryStream.Dispose();
				result = OperateResult.CreateFailedResult<Bitmap>(operateResult);
			}
			else
			{
				Bitmap value = new Bitmap(memoryStream);
				memoryStream.Dispose();
				result = OperateResult.CreateSuccessResult<Bitmap>(value);
			}
			return result;
		}

		/// <summary>
		/// 上传一个Bitmap图片对象到服务器指定的分类下面，需要指定分类信息，服务器保存的文件名，描述信息，支持进度报告<br />
		/// Upload a Bitmap image object to the category specified by the server, you need to specify the category information, 
		/// the file name saved by the server, description information, and support for progress reports
		/// </summary>
		/// <param name="bitmap">图片对象</param>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="serverName">在服务器保存的文件名称</param>
		/// <param name="fileTag">文件的额外的描述信息</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <returns>是否上传成功</returns>
		// Token: 0x06000EFE RID: 3838 RVA: 0x000589E0 File Offset: 0x00056BE0
		public OperateResult UploadFile(Bitmap bitmap, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			MemoryStream memoryStream = new MemoryStream();
			bool flag = bitmap.RawFormat != null;
			if (flag)
			{
				bitmap.Save(memoryStream, bitmap.RawFormat);
			}
			else
			{
				bitmap.Save(memoryStream, ImageFormat.Bmp);
			}
			OperateResult result = this.UploadFileBase(memoryStream, groups, serverName, fileTag, processReport);
			memoryStream.Dispose();
			return result;
		}

		/// <summary>
		/// 上传文件给服务器，需要指定上传的数据内容，上传到服务器的分类信息，支持进度汇报功能。<br />
		/// To upload files to the server, you need to specify the content of the uploaded data, 
		/// the classification information uploaded to the server, and support the progress report function.
		/// </summary>
		/// <param name="source">数据源，可以是文件名，也可以是数据流</param>
		/// <param name="serverName">在服务器保存的文件名，不包含驱动器路径</param>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="fileTag">文件的额外的描述信息</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <returns>是否成功的结果对象</returns>
		// Token: 0x06000EFF RID: 3839 RVA: 0x00058A38 File Offset: 0x00056C38
		private OperateResult UploadFileBase(object source, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(102, groups, new string[]
			{
				serverName
			});
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = operateResult;
			}
			else
			{
				string text = source as string;
				bool flag2 = text != null;
				if (flag2)
				{
					OperateResult operateResult2 = base.SendMqttFile(operateResult.Content, text, serverName, fileTag, processReport);
					bool flag3 = !operateResult2.IsSuccess;
					if (flag3)
					{
						return operateResult2;
					}
				}
				else
				{
					Stream stream = source as Stream;
					bool flag4 = stream != null;
					if (!flag4)
					{
						Socket content = operateResult.Content;
						if (content != null)
						{
							content.Close();
						}
						ILogNet logNet = base.LogNet;
						if (logNet != null)
						{
							logNet.WriteError(this.ToString(), StringResources.Language.DataSourceFormatError);
						}
						return new OperateResult(StringResources.Language.DataSourceFormatError);
					}
					OperateResult operateResult3 = base.SendMqttFile(operateResult.Content, stream, serverName, fileTag, processReport);
					bool flag5 = !operateResult3.IsSuccess;
					if (flag5)
					{
						return operateResult3;
					}
				}
				OperateResult<byte, byte[]> operateResult4 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
				bool flag6 = !operateResult4.IsSuccess;
				if (flag6)
				{
					result = operateResult4;
				}
				else
				{
					Socket content2 = operateResult.Content;
					if (content2 != null)
					{
						content2.Close();
					}
					result = ((operateResult4.Content1 != 0) ? OperateResult.CreateSuccessResult() : new OperateResult(Encoding.UTF8.GetString(operateResult4.Content2)));
				}
			}
			return result;
		}

		/// <summary>
		/// 上传文件给服务器，需要指定上传文件的路径信息，服务器保存的名字，以及上传到服务器的分类信息，支持进度汇报功能。<br />
		/// To upload a file to the server, you need to specify the path information of the uploaded file, the name saved by the server, 
		/// and the classification information uploaded to the server to support the progress report function.
		/// </summary>
		/// <param name="fileName">文件名，需要指定完整的路径信息，文件必须存在，否则发送失败</param>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="serverName">服务器端保存的文件名</param>
		/// <param name="fileTag">文件的额外的描述信息</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <returns>是否上传成功的结果对象</returns>
		// Token: 0x06000F00 RID: 3840 RVA: 0x00058BA4 File Offset: 0x00056DA4
		public OperateResult UploadFile(string fileName, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			bool flag = !File.Exists(fileName);
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.FileNotExist);
			}
			else
			{
				result = this.UploadFileBase(fileName, groups, serverName, fileTag, processReport);
			}
			return result;
		}

		/// <summary>
		/// 上传文件给服务器，需要指定上传文件的路径信息(服务器保存的名称就是文件名)，以及上传到服务器的分类信息，支持进度汇报功能。<br />
		/// To upload a file to the server, you need to specify the path information of the uploaded file (the name saved by the server is the file name), 
		/// as well as the classification information uploaded to the server, to support the progress report function.
		/// </summary>
		/// <param name="fileName">文件名，需要指定完整的路径信息，文件必须存在，否则发送失败</param>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="fileTag">文件的额外的描述信息</param>
		/// <param name="processReport">进度报告，第一个参数是已完成字节数，第二个参数是总字节数</param>
		/// <returns>是否上传成功的结果对象</returns>
		// Token: 0x06000F01 RID: 3841 RVA: 0x00058BE4 File Offset: 0x00056DE4
		public OperateResult UploadFile(string fileName, string groups, string fileTag, Action<long, long> processReport)
		{
			bool flag = !File.Exists(fileName);
			OperateResult result;
			if (flag)
			{
				result = new OperateResult(StringResources.Language.FileNotExist);
			}
			else
			{
				FileInfo fileInfo = new FileInfo(fileName);
				result = this.UploadFileBase(fileName, groups, fileInfo.Name, fileTag, processReport);
			}
			return result;
		}

		// Token: 0x06000F02 RID: 3842 RVA: 0x00058C30 File Offset: 0x00056E30
		private OperateResult<T[]> DownloadStringArrays<T>(byte protocol, string groups, string[] fileNames)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(protocol, groups, fileNames);
			bool flag = !operateResult.IsSuccess;
			OperateResult<T[]> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<T[]>(operateResult);
			}
			else
			{
				OperateResult<byte, byte[]> operateResult2 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<T[]>(operateResult2);
				}
				else
				{
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					try
					{
						result = OperateResult.CreateSuccessResult<T[]>(JArray.Parse(Encoding.UTF8.GetString(operateResult2.Content2)).ToObject<T[]>());
					}
					catch (Exception ex)
					{
						result = new OperateResult<T[]>(ex.Message);
					}
				}
			}
			return result;
		}

		/// <summary>
		/// 下载指定分类信息的所有的文件描述信息，需要指定分类信息，例如：Files/Personal/Admin<br />
		/// To download all the file description information of the specified classification information, 
		/// you need to specify the classification information, for example: Files/Personal/Admin
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <returns>当前分类下所有的文件描述信息</returns>
		// Token: 0x06000F03 RID: 3843 RVA: 0x00058CE4 File Offset: 0x00056EE4
		public OperateResult<GroupFileItem[]> DownloadPathFileNames(string groups)
		{
			return this.DownloadStringArrays<GroupFileItem>(105, groups, null);
		}

		/// <summary>
		/// 下载指定分类信息的全部子分类信息<br />
		/// Download all sub-category information of the specified category information
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <returns>当前分类下所有的子分类信息</returns>
		// Token: 0x06000F04 RID: 3844 RVA: 0x00058D00 File Offset: 0x00056F00
		public OperateResult<string[]> DownloadPathFolders(string groups)
		{
			return this.DownloadStringArrays<string>(106, groups, null);
		}

		/// <summary>
		/// 请求服务器指定分类是否存在指定的文件名，需要指定分类信息，文件名<br />
		/// Request the server to specify whether the specified file name exists in the specified category, need to specify the category information, file name
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="fileName">文件名信息，例如 123.txt</param>
		/// <returns>Content为True表示存在，否则为不存在</returns>
		// Token: 0x06000F05 RID: 3845 RVA: 0x00058D1C File Offset: 0x00056F1C
		public OperateResult<bool> IsFileExists(string groups, string fileName)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(107, groups, new string[]
			{
				fileName
			});
			bool flag = !operateResult.IsSuccess;
			OperateResult<bool> result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool>(operateResult);
			}
			else
			{
				OperateResult<byte, byte[]> operateResult2 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool>(operateResult2);
				}
				else
				{
					OperateResult<bool> operateResult3 = OperateResult.CreateSuccessResult<bool>(operateResult2.Content1 == 1);
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					result = operateResult3;
				}
			}
			return result;
		}

		/// <summary>
		/// 删除服务器的指定的文件名，需要指定分类信息，文件名<br />
		/// Delete the specified file name of the server, need to specify the classification information, file name
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <param name="fileName">文件名信息</param>
		/// <returns>是否删除成功</returns>
		// Token: 0x06000F06 RID: 3846 RVA: 0x00058DA9 File Offset: 0x00056FA9
		public OperateResult DeleteFile(string groups, string fileName)
		{
			return this.DeleteFile(groups, new string[]
			{
				fileName
			});
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DeleteFile(System.String,System.String)" />
		// Token: 0x06000F07 RID: 3847 RVA: 0x00058DBC File Offset: 0x00056FBC
		public OperateResult DeleteFile(string groups, string[] fileNames)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(103, groups, fileNames);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool>(operateResult);
			}
			else
			{
				OperateResult<byte, byte[]> operateResult2 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool>(operateResult2);
				}
				else
				{
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					result = OperateResult.CreateSuccessResult();
				}
			}
			return result;
		}

		/// <summary>
		/// 删除服务器上指定的分类信息及管理的所有的文件，包含所有的子分类信息，不可逆操作，谨慎操作。<br />
		/// Delete the specified classification information and all files managed on the server, 
		/// including all sub-classification information, irreversible operation, and careful operation.
		/// </summary>
		/// <param name="groups">文件的类别，例如 Files/Personal/Admin 按照斜杠来区分</param>
		/// <returns>是否删除成功</returns>
		// Token: 0x06000F08 RID: 3848 RVA: 0x00058E34 File Offset: 0x00057034
		public OperateResult DeleteFolderFiles(string groups)
		{
			OperateResult<Socket> operateResult = this.ConnectFileServer(104, groups, null);
			bool flag = !operateResult.IsSuccess;
			OperateResult result;
			if (flag)
			{
				result = OperateResult.CreateFailedResult<bool>(operateResult);
			}
			else
			{
				OperateResult<byte, byte[]> operateResult2 = base.ReceiveMqttMessage(operateResult.Content, 60000, null);
				bool flag2 = !operateResult2.IsSuccess;
				if (flag2)
				{
					result = OperateResult.CreateFailedResult<bool>(operateResult2);
				}
				else
				{
					Socket content = operateResult.Content;
					if (content != null)
					{
						content.Close();
					}
					result = OperateResult.CreateSuccessResult();
				}
			}
			return result;
		}

		// Token: 0x06000F09 RID: 3849 RVA: 0x00058EAC File Offset: 0x000570AC
		[DebuggerStepThrough]
		private Task<OperateResult<Socket>> ConnectFileServerAsync(byte code, string groups, string[] fileNames)
		{
			MqttSyncClient.<ConnectFileServerAsync>d__43 <ConnectFileServerAsync>d__ = new MqttSyncClient.<ConnectFileServerAsync>d__43();
			<ConnectFileServerAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<Socket>>.Create();
			<ConnectFileServerAsync>d__.<>4__this = this;
			<ConnectFileServerAsync>d__.code = code;
			<ConnectFileServerAsync>d__.groups = groups;
			<ConnectFileServerAsync>d__.fileNames = fileNames;
			<ConnectFileServerAsync>d__.<>1__state = -1;
			<ConnectFileServerAsync>d__.<>t__builder.Start<MqttSyncClient.<ConnectFileServerAsync>d__43>(ref <ConnectFileServerAsync>d__);
			return <ConnectFileServerAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000F0A RID: 3850 RVA: 0x00058F08 File Offset: 0x00057108
		[DebuggerStepThrough]
		private Task<OperateResult> DownloadFileBaseAsync(string groups, string fileName, Action<long, long> processReport, object source)
		{
			MqttSyncClient.<DownloadFileBaseAsync>d__44 <DownloadFileBaseAsync>d__ = new MqttSyncClient.<DownloadFileBaseAsync>d__44();
			<DownloadFileBaseAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DownloadFileBaseAsync>d__.<>4__this = this;
			<DownloadFileBaseAsync>d__.groups = groups;
			<DownloadFileBaseAsync>d__.fileName = fileName;
			<DownloadFileBaseAsync>d__.processReport = processReport;
			<DownloadFileBaseAsync>d__.source = source;
			<DownloadFileBaseAsync>d__.<>1__state = -1;
			<DownloadFileBaseAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadFileBaseAsync>d__44>(ref <DownloadFileBaseAsync>d__);
			return <DownloadFileBaseAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DownloadFile(System.String,System.String,System.Action{System.Int64,System.Int64},System.String)" />
		// Token: 0x06000F0B RID: 3851 RVA: 0x00058F6C File Offset: 0x0005716C
		[DebuggerStepThrough]
		public Task<OperateResult> DownloadFileAsync(string groups, string fileName, Action<long, long> processReport, string fileSaveName)
		{
			MqttSyncClient.<DownloadFileAsync>d__45 <DownloadFileAsync>d__ = new MqttSyncClient.<DownloadFileAsync>d__45();
			<DownloadFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DownloadFileAsync>d__.<>4__this = this;
			<DownloadFileAsync>d__.groups = groups;
			<DownloadFileAsync>d__.fileName = fileName;
			<DownloadFileAsync>d__.processReport = processReport;
			<DownloadFileAsync>d__.fileSaveName = fileSaveName;
			<DownloadFileAsync>d__.<>1__state = -1;
			<DownloadFileAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadFileAsync>d__45>(ref <DownloadFileAsync>d__);
			return <DownloadFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DownloadFile(System.String,System.String,System.Action{System.Int64,System.Int64},System.IO.Stream)" />
		// Token: 0x06000F0C RID: 3852 RVA: 0x00058FD0 File Offset: 0x000571D0
		[DebuggerStepThrough]
		public Task<OperateResult> DownloadFileAsync(string groups, string fileName, Action<long, long> processReport, Stream stream)
		{
			MqttSyncClient.<DownloadFileAsync>d__46 <DownloadFileAsync>d__ = new MqttSyncClient.<DownloadFileAsync>d__46();
			<DownloadFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DownloadFileAsync>d__.<>4__this = this;
			<DownloadFileAsync>d__.groups = groups;
			<DownloadFileAsync>d__.fileName = fileName;
			<DownloadFileAsync>d__.processReport = processReport;
			<DownloadFileAsync>d__.stream = stream;
			<DownloadFileAsync>d__.<>1__state = -1;
			<DownloadFileAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadFileAsync>d__46>(ref <DownloadFileAsync>d__);
			return <DownloadFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DownloadBitmap(System.String,System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000F0D RID: 3853 RVA: 0x00059034 File Offset: 0x00057234
		[DebuggerStepThrough]
		public Task<OperateResult<Bitmap>> DownloadBitmapAsync(string groups, string fileName, Action<long, long> processReport)
		{
			MqttSyncClient.<DownloadBitmapAsync>d__47 <DownloadBitmapAsync>d__ = new MqttSyncClient.<DownloadBitmapAsync>d__47();
			<DownloadBitmapAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<Bitmap>>.Create();
			<DownloadBitmapAsync>d__.<>4__this = this;
			<DownloadBitmapAsync>d__.groups = groups;
			<DownloadBitmapAsync>d__.fileName = fileName;
			<DownloadBitmapAsync>d__.processReport = processReport;
			<DownloadBitmapAsync>d__.<>1__state = -1;
			<DownloadBitmapAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadBitmapAsync>d__47>(ref <DownloadBitmapAsync>d__);
			return <DownloadBitmapAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.UploadFile(System.Drawing.Bitmap,System.String,System.String,System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000F0E RID: 3854 RVA: 0x00059090 File Offset: 0x00057290
		[DebuggerStepThrough]
		public Task<OperateResult> UploadFileAsync(Bitmap bitmap, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			MqttSyncClient.<UploadFileAsync>d__48 <UploadFileAsync>d__ = new MqttSyncClient.<UploadFileAsync>d__48();
			<UploadFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<UploadFileAsync>d__.<>4__this = this;
			<UploadFileAsync>d__.bitmap = bitmap;
			<UploadFileAsync>d__.groups = groups;
			<UploadFileAsync>d__.serverName = serverName;
			<UploadFileAsync>d__.fileTag = fileTag;
			<UploadFileAsync>d__.processReport = processReport;
			<UploadFileAsync>d__.<>1__state = -1;
			<UploadFileAsync>d__.<>t__builder.Start<MqttSyncClient.<UploadFileAsync>d__48>(ref <UploadFileAsync>d__);
			return <UploadFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.UploadFileBase(System.Object,System.String,System.String,System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000F0F RID: 3855 RVA: 0x000590FC File Offset: 0x000572FC
		[DebuggerStepThrough]
		private Task<OperateResult> UploadFileBaseAsync(object source, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			MqttSyncClient.<UploadFileBaseAsync>d__49 <UploadFileBaseAsync>d__ = new MqttSyncClient.<UploadFileBaseAsync>d__49();
			<UploadFileBaseAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<UploadFileBaseAsync>d__.<>4__this = this;
			<UploadFileBaseAsync>d__.source = source;
			<UploadFileBaseAsync>d__.groups = groups;
			<UploadFileBaseAsync>d__.serverName = serverName;
			<UploadFileBaseAsync>d__.fileTag = fileTag;
			<UploadFileBaseAsync>d__.processReport = processReport;
			<UploadFileBaseAsync>d__.<>1__state = -1;
			<UploadFileBaseAsync>d__.<>t__builder.Start<MqttSyncClient.<UploadFileBaseAsync>d__49>(ref <UploadFileBaseAsync>d__);
			return <UploadFileBaseAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.UploadFile(System.String,System.String,System.String,System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000F10 RID: 3856 RVA: 0x00059168 File Offset: 0x00057368
		[DebuggerStepThrough]
		public Task<OperateResult> UploadFileAsync(string fileName, string groups, string serverName, string fileTag, Action<long, long> processReport)
		{
			MqttSyncClient.<UploadFileAsync>d__50 <UploadFileAsync>d__ = new MqttSyncClient.<UploadFileAsync>d__50();
			<UploadFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<UploadFileAsync>d__.<>4__this = this;
			<UploadFileAsync>d__.fileName = fileName;
			<UploadFileAsync>d__.groups = groups;
			<UploadFileAsync>d__.serverName = serverName;
			<UploadFileAsync>d__.fileTag = fileTag;
			<UploadFileAsync>d__.processReport = processReport;
			<UploadFileAsync>d__.<>1__state = -1;
			<UploadFileAsync>d__.<>t__builder.Start<MqttSyncClient.<UploadFileAsync>d__50>(ref <UploadFileAsync>d__);
			return <UploadFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.UploadFile(System.String,System.String,System.String,System.Action{System.Int64,System.Int64})" />
		// Token: 0x06000F11 RID: 3857 RVA: 0x000591D4 File Offset: 0x000573D4
		[DebuggerStepThrough]
		public Task<OperateResult> UploadFileAsync(string fileName, string groups, string fileTag, Action<long, long> processReport)
		{
			MqttSyncClient.<UploadFileAsync>d__51 <UploadFileAsync>d__ = new MqttSyncClient.<UploadFileAsync>d__51();
			<UploadFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<UploadFileAsync>d__.<>4__this = this;
			<UploadFileAsync>d__.fileName = fileName;
			<UploadFileAsync>d__.groups = groups;
			<UploadFileAsync>d__.fileTag = fileTag;
			<UploadFileAsync>d__.processReport = processReport;
			<UploadFileAsync>d__.<>1__state = -1;
			<UploadFileAsync>d__.<>t__builder.Start<MqttSyncClient.<UploadFileAsync>d__51>(ref <UploadFileAsync>d__);
			return <UploadFileAsync>d__.<>t__builder.Task;
		}

		// Token: 0x06000F12 RID: 3858 RVA: 0x00059238 File Offset: 0x00057438
		[DebuggerStepThrough]
		private Task<OperateResult<T[]>> DownloadStringArraysAsync<T>(byte protocol, string groups, string[] fileNames)
		{
			MqttSyncClient.<DownloadStringArraysAsync>d__52<T> <DownloadStringArraysAsync>d__ = new MqttSyncClient.<DownloadStringArraysAsync>d__52<T>();
			<DownloadStringArraysAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<T[]>>.Create();
			<DownloadStringArraysAsync>d__.<>4__this = this;
			<DownloadStringArraysAsync>d__.protocol = protocol;
			<DownloadStringArraysAsync>d__.groups = groups;
			<DownloadStringArraysAsync>d__.fileNames = fileNames;
			<DownloadStringArraysAsync>d__.<>1__state = -1;
			<DownloadStringArraysAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadStringArraysAsync>d__52<T>>(ref <DownloadStringArraysAsync>d__);
			return <DownloadStringArraysAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DownloadPathFileNames(System.String)" />
		// Token: 0x06000F13 RID: 3859 RVA: 0x00059294 File Offset: 0x00057494
		[DebuggerStepThrough]
		public Task<OperateResult<GroupFileItem[]>> DownloadPathFileNamesAsync(string groups)
		{
			MqttSyncClient.<DownloadPathFileNamesAsync>d__53 <DownloadPathFileNamesAsync>d__ = new MqttSyncClient.<DownloadPathFileNamesAsync>d__53();
			<DownloadPathFileNamesAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<GroupFileItem[]>>.Create();
			<DownloadPathFileNamesAsync>d__.<>4__this = this;
			<DownloadPathFileNamesAsync>d__.groups = groups;
			<DownloadPathFileNamesAsync>d__.<>1__state = -1;
			<DownloadPathFileNamesAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadPathFileNamesAsync>d__53>(ref <DownloadPathFileNamesAsync>d__);
			return <DownloadPathFileNamesAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DownloadPathFolders(System.String)" />
		// Token: 0x06000F14 RID: 3860 RVA: 0x000592E0 File Offset: 0x000574E0
		[DebuggerStepThrough]
		public Task<OperateResult<string[]>> DownloadPathFoldersAsync(string groups)
		{
			MqttSyncClient.<DownloadPathFoldersAsync>d__54 <DownloadPathFoldersAsync>d__ = new MqttSyncClient.<DownloadPathFoldersAsync>d__54();
			<DownloadPathFoldersAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<string[]>>.Create();
			<DownloadPathFoldersAsync>d__.<>4__this = this;
			<DownloadPathFoldersAsync>d__.groups = groups;
			<DownloadPathFoldersAsync>d__.<>1__state = -1;
			<DownloadPathFoldersAsync>d__.<>t__builder.Start<MqttSyncClient.<DownloadPathFoldersAsync>d__54>(ref <DownloadPathFoldersAsync>d__);
			return <DownloadPathFoldersAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.IsFileExists(System.String,System.String)" />
		// Token: 0x06000F15 RID: 3861 RVA: 0x0005932C File Offset: 0x0005752C
		[DebuggerStepThrough]
		public Task<OperateResult<bool>> IsFileExistsAsync(string groups, string fileName)
		{
			MqttSyncClient.<IsFileExistsAsync>d__55 <IsFileExistsAsync>d__ = new MqttSyncClient.<IsFileExistsAsync>d__55();
			<IsFileExistsAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult<bool>>.Create();
			<IsFileExistsAsync>d__.<>4__this = this;
			<IsFileExistsAsync>d__.groups = groups;
			<IsFileExistsAsync>d__.fileName = fileName;
			<IsFileExistsAsync>d__.<>1__state = -1;
			<IsFileExistsAsync>d__.<>t__builder.Start<MqttSyncClient.<IsFileExistsAsync>d__55>(ref <IsFileExistsAsync>d__);
			return <IsFileExistsAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DeleteFile(System.String,System.String)" />
		// Token: 0x06000F16 RID: 3862 RVA: 0x00059380 File Offset: 0x00057580
		[DebuggerStepThrough]
		public Task<OperateResult> DeleteFileAsync(string groups, string fileName)
		{
			MqttSyncClient.<DeleteFileAsync>d__56 <DeleteFileAsync>d__ = new MqttSyncClient.<DeleteFileAsync>d__56();
			<DeleteFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DeleteFileAsync>d__.<>4__this = this;
			<DeleteFileAsync>d__.groups = groups;
			<DeleteFileAsync>d__.fileName = fileName;
			<DeleteFileAsync>d__.<>1__state = -1;
			<DeleteFileAsync>d__.<>t__builder.Start<MqttSyncClient.<DeleteFileAsync>d__56>(ref <DeleteFileAsync>d__);
			return <DeleteFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DeleteFile(System.String,System.String[])" />
		// Token: 0x06000F17 RID: 3863 RVA: 0x000593D4 File Offset: 0x000575D4
		[DebuggerStepThrough]
		public Task<OperateResult> DeleteFileAsync(string groups, string[] fileNames)
		{
			MqttSyncClient.<DeleteFileAsync>d__57 <DeleteFileAsync>d__ = new MqttSyncClient.<DeleteFileAsync>d__57();
			<DeleteFileAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DeleteFileAsync>d__.<>4__this = this;
			<DeleteFileAsync>d__.groups = groups;
			<DeleteFileAsync>d__.fileNames = fileNames;
			<DeleteFileAsync>d__.<>1__state = -1;
			<DeleteFileAsync>d__.<>t__builder.Start<MqttSyncClient.<DeleteFileAsync>d__57>(ref <DeleteFileAsync>d__);
			return <DeleteFileAsync>d__.<>t__builder.Task;
		}

		/// <inheritdoc cref="M:HslCommunication.MQTT.MqttSyncClient.DeleteFolderFiles(System.String)" />
		// Token: 0x06000F18 RID: 3864 RVA: 0x00059428 File Offset: 0x00057628
		[DebuggerStepThrough]
		public Task<OperateResult> DeleteFolderFilesAsync(string groups)
		{
			MqttSyncClient.<DeleteFolderFilesAsync>d__58 <DeleteFolderFilesAsync>d__ = new MqttSyncClient.<DeleteFolderFilesAsync>d__58();
			<DeleteFolderFilesAsync>d__.<>t__builder = AsyncTaskMethodBuilder<OperateResult>.Create();
			<DeleteFolderFilesAsync>d__.<>4__this = this;
			<DeleteFolderFilesAsync>d__.groups = groups;
			<DeleteFolderFilesAsync>d__.<>1__state = -1;
			<DeleteFolderFilesAsync>d__.<>t__builder.Start<MqttSyncClient.<DeleteFolderFilesAsync>d__58>(ref <DeleteFolderFilesAsync>d__);
			return <DeleteFolderFilesAsync>d__.<>t__builder.Task;
		}

		/// <summary>
		/// 获取或设置当前的连接信息，客户端将根据这个连接配置进行连接服务器，在连接之前需要设置相关的信息才有效。<br />
		/// To obtain or set the current connection information, the client will connect to the server according to this connection configuration. 
		/// Before connecting, the relevant information needs to be set to be effective.
		/// </summary>
		// Token: 0x17000232 RID: 562
		// (get) Token: 0x06000F19 RID: 3865 RVA: 0x00059473 File Offset: 0x00057673
		// (set) Token: 0x06000F1A RID: 3866 RVA: 0x0005947B File Offset: 0x0005767B
		public MqttConnectionOptions ConnectionOptions
		{
			get
			{
				return this.connectionOptions;
			}
			set
			{
				this.connectionOptions = value;
			}
		}

		/// <summary>
		/// 获取或设置使用字符串访问的时候，使用的编码信息，默认为UT8编码<br />
		/// Get or set the encoding information used when accessing with a string, the default is UT8 encoding
		/// </summary>
		// Token: 0x17000233 RID: 563
		// (get) Token: 0x06000F1B RID: 3867 RVA: 0x00059484 File Offset: 0x00057684
		// (set) Token: 0x06000F1C RID: 3868 RVA: 0x0005948C File Offset: 0x0005768C
		public Encoding StringEncoding
		{
			get
			{
				return this.stringEncoding;
			}
			set
			{
				this.stringEncoding = value;
			}
		}

		/// <inheritdoc />
		// Token: 0x06000F1D RID: 3869 RVA: 0x00059495 File Offset: 0x00057695
		public override string ToString()
		{
			return string.Format("MqttSyncClient[{0}:{1}]", this.connectionOptions.IpAddress, this.connectionOptions.Port);
		}

		// Token: 0x04000415 RID: 1045
		private SoftIncrementCount incrementCount;

		// Token: 0x04000416 RID: 1046
		private MqttConnectionOptions connectionOptions;

		// Token: 0x04000417 RID: 1047
		private Encoding stringEncoding = Encoding.UTF8;
	}
}
